﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace Sige
{
    public class Accesoadatos
    {
        public SqlConnection ObtenerConexion(string rutaBD)
        {
            SqlConnection cn = new SqlConnection(rutaBD);
            try
            {
                cn.Open();
                return cn;
            }
            catch (Exception ex)
            {
                return null;
            }
        }  // fin obtener conexion

        public SqlDataAdapter ObtenerAdaptador(string consultaSQL, SqlConnection cn)
        {
            SqlDataAdapter adaptador;
            try
            {
                adaptador = new SqlDataAdapter(consultaSQL, cn);
                return adaptador;
            }
            catch
            {
                return null;
            }
        }
        public string getruta()
        {
            //string rutaBDSuperbit = "Data Source=LFV-PC\\SQLEXPRESS;Initial Catalog=DbSuperbit;Integrated Security=True";
            //string rutaBDSuperbit = @"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\SUPERBIT-V2\SuperbitSige\SuperbitSige\BD\DbSuperbit.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
            string rutaBDSuperbit =  "Data Source=localhost;Initial Catalog=DbSuperbit;Integrated Security=True";
            //string rutaBDSuperbit = "Data Source=GABY-NOTE\\SQLEXPRESS;Initial Catalog=DbSuperbit;Integrated Security=True";
            return rutaBDSuperbit;
        }
    }
}
